<template>
	<view>
		<uni-card title="用途">
			<view>一个应用中充斥着操作反馈，主要有成功提示、错误提示、二次确认提示等。有必要做轻量级的封装，避免出现大规模修改的情况。</view>
		</uni-card>
		
		<uni-card title="介绍">
			<view>源代码位于：/common/utils/feedback.js</view>
		</uni-card>
		
		<uni-card title="使用样例">
			<button
				type="primary"
				block
				@tap="showSuccess"
			>成功提示</button>
			<button
				style="margin-top: 24rpx;"
				type="primary"
				block
				@tap="showWarn"
			>错误提示</button>
			<button
				style="margin-top: 24rpx;"
				type="primary"
				block
				@tap="showConfirm"
			>二次确认</button>
		</uni-card>
	</view>
</template>

<script>
	import { success, warn, confirm } from '../../../common/utils/feedback'
	export default {
		data() {
			return {}
		},
		onLoad() {

		},
		methods: {
			showSuccess () {
				success('操作成功')
			},
			showWarn () {
				warn('操作失败')
			},
			async showConfirm () {
				await confirm('确认执行？')
				success('执行')
			}
		}
	}
</script>

<style></style>
